﻿@model Xfm.Core.Table.PageData<Xfm.TestEntities.Film>
@{
    ViewData["Title"] = "MyTable";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">Responsive Hover Table</h3>
                    <div class="row">
                        <div class="col-xs-2">
                            <input class="form-control" id="q" name="q" type="text" placeholder="查询条件" />
                        </div>
                        <div class="col-xs-2">
                            <select class="form-control" id="sel" name="sel">
                                <option value="0">0</option>
                                <option value="1">1</option>
                            </select>
                        </div>
                        <div class="col-xs-2">
                            <bt id="se" color="Primary">查询</bt>
                        </div>
                    </div>
                    
                    <div class="card-tools">
                        <div class="input-group input-group-sm" style="width: 150px;">
                            <input type="text" name="table_search" class="form-control float-right" placeholder="Search">

                            <div class="input-group-append">
                                <button type="submit" class="btn btn-default"><i class="fas fa-search"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="card-body table-responsive p-0">
                    <table id="table" class="table table-hover text-nowrap">
                        <thead>
                            <tr>
                                <th id="FilmId" name="FilmId">FilmId</th>
                                <th class="od" name="lastupdate">LastUpdate</th>
                                <th id="date" name="RentalRate">RentalRate</th>
                                <th>Title</th>
                                <th>Description</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in Model.Data)
                            {
                                <tr>
                                    <td>@item.FilmId</td>
                                    <td>@item.LastUpdate</td>
                                    <td>@item.RentalRate</td>
                                    <td>@item.Title</td>
                                    <td>@item.Description</td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                <div class="card-footer clearfix">
                    <page id="page" asp-for="Model"></page>
                </div>
            </div>
        </div>
    </div>
</div>
@section Scripts{
    
    <script>
        $(function () {
            $("#page").page({
                on: ["#q", ["#sel", "myName"]],//绑定过滤控件,默认参数名为控件name，也能数组[1]传控件name
                go: ["#se", ["#sel", "change"]], //绑定其他自定义的跳转控件，数组[1]为事件名称
                order: ["#FilmId", ".od", ["#date", "RentalRate"]],//绑定排序字段，控件包含name或者数组[1]指定字段
            });
        })
        
    </script>
}